#include <iostream>
#include <cstdio>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <cmath>
#include <cstring>
#include <string>
#include <iomanip>
#include <climits>
#include <unordered_map>
#include <unordered_set>
#define int long long
#define x first 
#define y second  
using namespace std;
const int N = 2e6 + 10;
int arr[N];
void solve()
{
        int x1,x2,x3;
        cin >> x1 >> x2 >> x3;
        int path1 = abs(x1 - x2) + abs(x2 - x3); 
        int path2 = abs(x1 - x3) + abs(x3 - x2); 
        cout << min(path1, path2) << endl;
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr),cout.tie(nullptr);
    int t;
    cin >> t;
    while(t -- )  solve();
    return 0;
}